#include <iostream>
#include <string>

using namespace std;

int n;
int age;
string s;
char wine[][20]={"ABSINTH", "BEER", "BRANDY", "CHAMPAGNE", "GIN", "RUM", "SAKE", "TEQUILA", "VODKA", "WHISKEY", "WINE"};
int main()
{
    int cnt;
    while(cin>>n)
    {
        cnt=0;
        while(n--)
        {
            cin>>s;
            if(s[0]>='0'&&s[0]<='9')
            {
                age=0;
                for(int i=0;i<s.size();i++) age=age*10+(s[i]-'0');
                if(age<18) cnt++;
            }
            else
            {
                for(int i=0;i<11;i++)
                    if(s==string(wine[i])) cnt++,i=20;
            }
        }
        cout<<cnt<<endl;
    }
}
